﻿namespace Sai.Core.Sandcastle
{
	using System.Collections.ObjectModel;

	public class TopicCollection : Collection<Topic>
	{
		public Topic SearchByGuid(string guid)
		{
			Topic foundTopic = null;

			if (!string.IsNullOrEmpty(guid))
			{
				foreach (Topic topic in this)
				{
					if (topic.Matches(guid))
					{
						foundTopic = topic;
						break;
					}
					else
					{
						foundTopic = topic.SearchByGuid(guid);

						if (foundTopic != null)
						{
							break;
						}
					}
				}
			}

			return foundTopic;
		}
	}
}
